//
//  Crowbar.h
//  glmixer
//
//  Created by Ilias Bergstrom on 26/02/13.
//
//

#ifndef __glmixer__Crowbar__
#define __glmixer__Crowbar__

#include <iostream>

#include "common.h"

#include <QThread>
#include <QUdpSocket>

#include "OscReceivedElements.h"
#include "OscPrintReceivedElements.h"
#include "UdpSocket.h"
#include "PacketListener.h"
#include "OscOutboundPacketStream.h"
#include "OscPacketListener.h"

class Source;

class Crowbar : public QObject {

   Q_OBJECT

// /Users/iliasbergstrom/Dropbox/GLMixer/glmixer_from_xcode/src/CMakeLists.txt

public:
   Crowbar();
   ~Crowbar();

   void readDataFromXML();

protected:

   // Copypasted from OscPacketListener

   void ProcessBundle( const osc::ReceivedBundle& b);

   void ProcessMessage( const osc::ReceivedMessage& m );

   void ProcessSourceMessage( const osc::ReceivedMessage& m, QString& message, Source* src ) ;

private slots:
    void processPendingDatagrams();

private:
    QUdpSocket udpSocket;

    QString messageStr;
    volatile bool stopped;

    int m_ReceivingPort;
    QString m_DestinationIP;
    int m_DestinationPort;
};

#endif /* defined(__glmixer__Crowbar__) */
